package me.lc.hammerheads.core;

import me.lc.hammerheads.R;
import android.app.Activity;
import android.content.SharedPreferences;

import com.wiyun.engine.opengl.Texture2D;
import com.wiyun.engine.sound.AudioManager;

public class GameSystem {

	public static final String WiGameAppKey = "6b3674ef55555356";

	public static final String WiGameSecretKey = "nEF2gXBgh6ZGcnmqQEKAS4FcTJJWNSVZ";

	/**
	 * 屏幕宽度
	 */
	public static float Screen_Width = 0;

	/**
	 * 屏幕高度
	 */
	public static float Screen_Height = 0;

	/**
	 * 屏幕实际高度
	 */
	public static float Screen_ActuallyHeight = 0;

	// tex
	public static Texture2D tex_help;
	public static Texture2D tex_hole;
	public static Texture2D tex_hole_summer;
	public static Texture2D tex_hole_winter;
	public static Texture2D tex_hole_livingroom;
	public static Texture2D tex_hole_tarmac;

	public static Texture2D tex_man1;
	public static Texture2D tex_female1;
	public static Texture2D tex_hatMan;
	public static Texture2D tex_bombMan;
	public static Texture2D tex_bombMan_explosion;
	public static Texture2D tex_heart_man;
	public static Texture2D tex_background_spring;
	public static Texture2D tex_background_summer;
	public static Texture2D tex_background_autumn;
	public static Texture2D tex_background_winter;
	public static Texture2D tex_background_desert;
	public static Texture2D tex_background_livingroom;
	public static Texture2D tex_background_tarmac;
	public static Texture2D tex_hammer1;
	public static Texture2D tex_strike;
	public static Texture2D tex_strike_ineffective;
	public static Texture2D tex_missing;

	public static Texture2D tex_platform;
	public static Texture2D tex_platform_summer;
	public static Texture2D tex_platform_autumn;
	public static Texture2D tex_platform_winter;
	public static Texture2D tex_platform_desert;
	public static Texture2D tex_platform_livingroom;
	public static Texture2D tex_platform_tarmac;

	public static Texture2D tex_sliverMan;
	public static Texture2D tex_luckDuck;

	public static Texture2D tex_mainBg;
	public static Texture2D tex_mainHammer;
	public static Texture2D tex_mainBottom;

	public static Texture2D tex_menuBg;
	public static Texture2D tex_menuBtnNormalGame;

	public static Texture2D tex_heartBg;
	public static Texture2D tex_heart;
	public static Texture2D tex_heart_empty;
	public static Texture2D tex_brokenheart;

	public static Texture2D tex_stageBg;
	public static Texture2D tex_stageButton;
	public static Texture2D tex_stageLocker;

	public static Texture2D tex_toolbarBg;
	public static Texture2D tex_doubleHammer;

	public static Texture2D loseBgTex;
	public static Texture2D winBgTex;
	public static Texture2D pauseBGTex;

	public static Activity AndroidContext;

	public static SharedPreferences SharedSettings;

	public static void loadAllResource() {
		initSetting();
		loadTexture();
		initStages();
		loadSound();
	}

	private static void loadSound() {
		AudioManager.preloadBackgroundMusic(R.raw.music_menu);
		AudioManager.preloadBackgroundMusic(R.raw.music_ingame);
		AudioManager.preloadEffect(R.raw.addheart);
		AudioManager.preloadEffect(R.raw.bombdwarf_explosion);
		AudioManager.preloadEffect(R.raw.bombdwarf_show);
		AudioManager.preloadEffect(R.raw.boom);
		AudioManager.preloadEffect(R.raw.buytool);
		AudioManager.preloadEffect(R.raw.duck);
		AudioManager.preloadEffect(R.raw.go);
		AudioManager.preloadEffect(R.raw.hammeraction);
		AudioManager.preloadEffect(R.raw.konckhat);
		AudioManager.preloadEffect(R.raw.lose);
		AudioManager.preloadEffect(R.raw.man_au);
		AudioManager.preloadEffect(R.raw.miss);
		AudioManager.preloadEffect(R.raw.silver_knock);
		AudioManager.preloadEffect(R.raw.win);
		AudioManager.preloadEffect(R.raw.woman_au);
		AudioManager.preloadEffect(R.raw.buttonclick);
		AudioManager.preloadEffect(R.raw.lost_heart);
		AudioManager.preloadEffect(R.raw.knock);
	}

	private static void initSetting() {
		SharedSettings = AndroidContext.getPreferences(Activity.MODE_PRIVATE);

	}

	private static void initStages() {
		StageManager.instance.init();

	}

	private static void loadTexture() {
		tex_help = Texture2D.makePNG(R.drawable.help);
		loseBgTex = Texture2D.makePNG(R.drawable.lose_bg);
		winBgTex = Texture2D.makePNG(R.drawable.win_bg);
		pauseBGTex = Texture2D.makePNG(R.drawable.pause_shop_bg);

		tex_hole = Texture2D.makePNG(R.drawable.hole);
		tex_hole_summer = Texture2D.makePNG(R.drawable.hole_summer);
		tex_hole_tarmac = Texture2D.makePNG(R.drawable.hole_tarmac);
		tex_hole_winter = Texture2D.makePNG(R.drawable.hole_winter);
		tex_hole_livingroom = Texture2D.makePNG(R.drawable.hole_livingroom);

		tex_man1 = Texture2D.makePNG(R.drawable.man1);
		tex_heart_man = Texture2D.makePNG(R.drawable.heart_man);

		tex_background_spring = Texture2D.makeJPG(R.drawable.background_spring);
		tex_background_summer = Texture2D.makeJPG(R.drawable.background_summer);
		tex_background_autumn = Texture2D.makeJPG(R.drawable.background_autumn);
		tex_background_winter = Texture2D.makeJPG(R.drawable.background_winter);
		tex_background_desert = Texture2D.makeJPG(R.drawable.background_desert);
		tex_background_livingroom = Texture2D
				.makeJPG(R.drawable.background_livingroom);
		tex_background_tarmac = Texture2D.makeJPG(R.drawable.background_tarmac);

		tex_hammer1 = Texture2D.makePNG(R.drawable.hammer1);
		tex_strike = Texture2D.makePNG(R.drawable.strike);
		tex_strike_ineffective = Texture2D
				.makePNG(R.drawable.strike_ineffective);
		tex_missing = Texture2D.makePNG(R.drawable.miss);
		tex_female1 = Texture2D.makePNG(R.drawable.female1);

		tex_platform = Texture2D.makePNG(R.drawable.platform);
		tex_platform_summer = Texture2D.makePNG(R.drawable.platform_summer);
		tex_platform_autumn = Texture2D.makePNG(R.drawable.platform_autumn);
		tex_platform_winter = Texture2D.makePNG(R.drawable.platform_winter);
		tex_platform_desert = Texture2D.makePNG(R.drawable.platform_deathvally);
		tex_platform_livingroom = Texture2D
				.makePNG(R.drawable.platform_livingroom);
		tex_platform_tarmac = Texture2D.makePNG(R.drawable.platform_tarmac);

		tex_hatMan = Texture2D.makePNG(R.drawable.male2);
		tex_bombMan = Texture2D.makePNG(R.drawable.gnomebomb);
		tex_bombMan_explosion = Texture2D.makePNG(R.drawable.gnome_explosion);
		tex_sliverMan = Texture2D.makePNG(R.drawable.dwarfsliver);
		tex_luckDuck = Texture2D.makePNG(R.drawable.duck);

		tex_mainBg = Texture2D.makeJPG(R.drawable.main);
		tex_mainBottom = Texture2D.makePNG(R.drawable.main_dwarfs);
		tex_mainHammer = Texture2D.makePNG(R.drawable.hammer_title);

		tex_menuBg = Texture2D.makePNG(R.drawable.mainmenu_bg);
		tex_menuBtnNormalGame = Texture2D.makePNG(R.drawable.button_normalgame);

		tex_heartBg = Texture2D.makePNG(R.drawable.heart_bg);
		tex_heart = Texture2D.makePNG(R.drawable.heart);
		tex_heart_empty = Texture2D.makePNG(R.drawable.heart_empty);
		tex_brokenheart = Texture2D.makePNG(R.drawable.brokenheart);

		tex_stageBg = Texture2D.makePNG(R.drawable.stage_bg);
		tex_stageButton = Texture2D.makePNG(R.drawable.stagebutton);
		tex_stageLocker = Texture2D.makePNG(R.drawable.lock);

		tex_toolbarBg = Texture2D.makePNG(R.drawable.toolbar);
		tex_doubleHammer = Texture2D.makePNG(R.drawable.hammer3);

		tex_help.loadTexture();
		loseBgTex.loadTexture();
		winBgTex.loadTexture();
		pauseBGTex.loadTexture();
		tex_doubleHammer.loadTexture();
		tex_toolbarBg.loadTexture();
		tex_stageLocker.loadTexture();
		tex_stageBg.loadTexture();
		tex_stageButton.loadTexture();
		tex_brokenheart.loadTexture();
		tex_heartBg.loadTexture();
		tex_heart.loadTexture();
		tex_heart_empty.loadTexture();
		tex_luckDuck.loadTexture();
		tex_mainBg.loadTexture();
		tex_mainBottom.loadTexture();
		tex_mainHammer.loadTexture();
		tex_sliverMan.loadTexture();
		tex_bombMan_explosion.loadTexture();
		tex_bombMan.loadTexture();
		tex_hatMan.loadTexture();

		tex_platform.loadTexture();
		tex_platform_summer.loadTexture();
		tex_platform_autumn.loadTexture();
		tex_platform_winter.loadTexture();
		tex_platform_desert.loadTexture();
		tex_platform_livingroom.loadTexture();
		tex_platform_tarmac.loadTexture();

		tex_female1.loadTexture();
		tex_hammer1.loadTexture();
		tex_strike.loadTexture();
		tex_strike_ineffective.loadTexture();
		tex_missing.loadTexture();
		tex_background_spring.loadTexture();
		tex_background_summer.loadTexture();
		tex_background_autumn.loadTexture();
		tex_background_winter.loadTexture();
		tex_background_desert.loadTexture();
		tex_background_livingroom.loadTexture();
		tex_background_tarmac.loadTexture();
		tex_heart_man.loadTexture();
		tex_hole.loadTexture();
		tex_hole_livingroom.loadTexture();
		tex_hole_summer.loadTexture();
		tex_hole_tarmac.loadTexture();
		tex_hole_winter.loadTexture();
		tex_man1.loadTexture();
	}
}
